<?php
/**
 * 消息管理
 */
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
header('Content-type:text/html;charset=utf-8');

class MessageController extends AdminbaseController{
	public function notice(){
		$data = M("notice")->select();
		$this->assign("data",$data);
		$this->display();
	}
	public function notice_add(){
		$this->display();
	}
	public function notice_add_post(){
		if(IS_POST){
			$data = $_POST;
			$data['create_time'] = date("Y-m-d H:i:s");
			$result = M("notice")->add($data);
			if($result){
				$this->success("发布成功",U('Message/notice'));
			}else{
				$this->error("发布失败");
			}
		}
	}
	public function notice_del(){
		$id = I("get.id");
		$result = M("notice")->where("id='$id'")->delete();
		if($result){
			$this->success("删除成功");
		}else{
			$this->error("删除失败");
		}
	}
}
?>